<?php
header("refresh:1;url=index.php");
include_once "header.php";

if(isset($_POST['sublogin'])){
	//echo '登陆来了....';
	$ucode = $_SESSION['ucode'];
	if($ucode == $_POST['ucode']){
		$stmt = $pdo->prepare("select id,uname from kp_user where uname = ? and upwd = ?");
		$stmt-> execute(array($_POST['uname'],$_POST['upwd']));
		$_SESSION = $stmt->fetch(PDO::FETCH_ASSOC);
		if(!empty($_SESSION['id'])){
			$uid = $_SESSION['id'];
			//echo '<script type="text/javascript">alert("登陆成功!");</script>';
		}else{
			echo '<script type="text/javascript">alert("登陆失败!");</script>';
		}
	}else{
		echo '<script type="text/javascript">alert("验证码不正确!");</script>';
	}
}

?>

<script type="text/javascript">
</script>

<body>
	<div style="width: 800px; height: 50px; margin: 0 auto;">
		<h1>登陆成功!</h1>
	</div>
	
</body>

<?php
include_once "bottom.html";
?>